package 面向对象.day03;

import java.util.Random;

/**
 * @author 王敬仟
 * SeaObjeck 海洋对象类
 */
public class SeaObject {
    /*海洋对象的共有属性*/
    protected int width;//宽
    protected int height;//高
    protected int x;//x轴坐标
    protected int y;//y轴坐标
    protected int speed;//移动速度
    /*给共有属性赋值 潜艇对象*/
    public SeaObject(int width,int height){
        this.width = width;
        this.height = height;
        x = -width;
        Random rand = new Random();
        y = rand.nextInt(479-height-150+1)+150;
        speed = rand.nextInt(3)+1;
    }
    /*重写海洋对象方法 给炸弹 鱼雷赋值*/
    public SeaObject(int width,int height,int x,int y,int speed){
        this.width = width;
        this.height = height;
        this.x = x;
        this.y = y;
        this.speed = speed;
    }
    /*海洋对象的移动方法*/
    public void move(){
        System.out.println("海洋对象移动");
    }
}
